package org.wkg.lesson07;

import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

public class Demo_701 {

    /**
     * 阻塞队列
     * @param args
     * @throws InterruptedException
     */

    public static void main(String[] args) throws InterruptedException {
        BlockingDeque<Integer> queue = new LinkedBlockingDeque<>(3);
        //BlockingDeque<Character> queue1 = new LinkedBlockingDeque<>(10);
        queue.put(1);
        queue.put(2);
        queue.put(3);
        System.out.println("队列插入3个元素，队列已满");
        /*queue.put(4);
        System.out.println("队列插入第四个元素");*/

        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println("队列已经取出3个元素");
        System.out.println(queue.take());
        System.out.println("队列取出第四个元素");
    }
}




